package sso.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @description:
 * @author: LiuXingYu
 * @date: 2021/7/28 20:29
 */
@Mapper
public interface UserMapper {

    @Select("select * from sys_user where username=#{username}")
    Map<String, Object> selectUserByName(String username);

    @Select("select permission from sys_user su left join sys_user_role sur on su.id = sur.user_id" +
            "    left join sys_role_menu srm on sur.role_id = srm.role_id" +
            "    left join sys_menu sm on srm.menu_id = sm.id" +
            "        where su.username=#{username}")
    List<String> selectUserPermission(String username);

}
